<?php

use think\Facade\Route;
use think\Facade\Env;

Route::domain(Env::get('app.api_url'), function () {

    header("Access-Control-Allow-Origin: *");
    header('Access-Control-Allow-Methods: POST, PUT, GET, OPTIONS, DELETE, HEAD, PATCH');
    header("Access-Control-Allow-Headers: token,tokens,language, Origin, X-Requested-With, Content-Type, Accept");
    Route::miss(function () {
        echo '无访问权限';
        exit();
    });

    Route::group('User', function () {
        Route::post('login', '/login'); //用户登录
        Route::get('info', '/info'); //获取绑定商家地址
        Route::get('getshopid', '/getshopid'); //获取绑定商家地址
        Route::rule('cart', '/cart'); //获取绑定商家地址
        Route::rule('address', '/address'); //获取绑定商家地址
        Route::post('address_del', '/address_del'); //获取绑定商家地址
        Route::post('CreatedOrder', '/CreatedOrder'); //获取绑定商家地址
        Route::get('Order', '/Order'); //获取绑定商家地址
        Route::get('Orderdetail', '/Orderdetail'); //获取绑定商家地址
        Route::post('Ordercacel', '/Ordercacel'); //获取绑定商家地址
        Route::post('Ordertrue', '/Ordertrue'); //获取绑定商家地址
        Route::post('Orderpay', '/Orderpay'); //获取绑定商家地址
        Route::rule('Collect', '/Collect'); //获取绑定商家地址
        Route::post('reorder', '/reorder'); //获取绑定商家地址
        Route::rule('callback', '/callback'); //获取绑定商家地址
        Route::get('pay', '/pay'); //获取绑定商家地址

    })->prefix('User');
    Route::group('Other', function () {
        Route::get('cate', '/cate'); //获取绑定商家地址
        Route::get('goodlist', '/goodlist'); //获取绑定商家地址
        Route::get('gooddetail', '/gooddetail'); //获取绑定商家地址
        Route::get('banner', '/banner'); //获取绑定商家地址
        Route::get('getaddress', '/getaddress'); //获取绑定商家地址
        Route::rule('helps', '/helps'); //获取绑定商家地址
        Route::get('other', '/other'); //获取绑定商家地址
        Route::rule('ceshi', '/ceshi'); //获取绑定商家地址
        Route::rule('ceshi2', '/ceshi2'); //获取绑定商家地址

    })->prefix('Other');
})->bind('api')->prefix('api');
